package com.wm.servicebase.exceptionhandle;

import com.wm.commonutils.result.ResultCode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author: sshdg
 * @Date: 2020/9/27 15:21
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GuliException extends RuntimeException{

    private Integer code;
    private String msg;



    private GuliException(String msg) {
        super(msg);
        this.msg = msg;
    }

    public static GuliException from(ResultCode resultCode) {
        return new GuliException(resultCode.getCode(), resultCode.getMsg());
    }


    public static GuliException from(String msg) {
        return new GuliException(20001, msg);
    }

}
